package com.nbsaas.boot.order.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "订单地址", model = "订单地址")
@Entity
@Table(name = "bs_order_address")
@Comment("订单收货地址表")
public class OrderAddress extends AbstractEntity {

    @Comment("订单ID")
    @FormField(title = "订单ID", sortNum = "1", grid = true, required = true)
    @Column(name = "order_id", nullable = false)
    private Long orderId;

    @Comment("订单编号")
    @FormField(title = "订单编号", sortNum = "2", grid = true, required = true)
    @Column(name = "order_no", nullable = false, length = 64)
    private String orderNo;

    @Comment("收货人姓名")
    @FormField(title = "收货人姓名", sortNum = "3", grid = true, required = true)
    @Column(name = "receiver_name", nullable = false, length = 50)
    private String receiverName;

    @Comment("收货人电话")
    @FormField(title = "收货人电话", sortNum = "4", grid = true, required = true)
    @Column(name = "receiver_phone", nullable = false, length = 20)
    private String receiverPhone;

    @Comment("收货人邮箱")
    @FormField(title = "收货人邮箱", sortNum = "5", grid = true)
    @Column(name = "receiver_email", length = 100)
    private String receiverEmail;

    @Comment("省份ID")
    @FormField(title = "省份ID", sortNum = "6", grid = true, required = true)
    @Column(name = "province_id", nullable = false)
    private Long provinceId;

    @Comment("省份名称")
    @FormField(title = "省份名称", sortNum = "7", grid = true, required = true)
    @Column(name = "province_name", nullable = false, length = 50)
    private String provinceName;

    @Comment("城市ID")
    @FormField(title = "城市ID", sortNum = "8", grid = true, required = true)
    @Column(name = "city_id", nullable = false)
    private Long cityId;

    @Comment("城市名称")
    @FormField(title = "城市名称", sortNum = "9", grid = true, required = true)
    @Column(name = "city_name", nullable = false, length = 50)
    private String cityName;

    @Comment("区县ID")
    @FormField(title = "区县ID", sortNum = "10", grid = true, required = true)
    @Column(name = "district_id", nullable = false)
    private Long districtId;

    @Comment("区县名称")
    @FormField(title = "区县名称", sortNum = "11", grid = true, required = true)
    @Column(name = "district_name", nullable = false, length = 50)
    private String districtName;

    @Comment("详细地址")
    @FormField(title = "详细地址", sortNum = "12", grid = true, required = true)
    @Column(name = "detail_address", nullable = false, length = 200)
    private String detailAddress;

    @Comment("邮政编码")
    @FormField(title = "邮政编码", sortNum = "13", grid = true)
    @Column(name = "postal_code", length = 10)
    private String postalCode;

    @Comment("是否默认地址")
    @FormField(title = "默认地址", sortNum = "14", grid = true, type = InputType.select)
    @Column(name = "is_default", nullable = false)
    private Boolean isDefault = false;
} 